<template>
    <div class="container row">
        <Table border="">
            <tr>
                <th>订单详情</th>
                <td>金额</td>
                <th>操作</th>
            </tr>
            <tr  v-for="(item,index) in goodlist" :key="index" >
                <td> <img :src="'http://127.0.0.1:8000/static/upload/'+item.img" width="240" height="240" class="rounded-corners img-fluid">{{item.title}}</td>
                <td>{{item.price}}</td>
                
                <td v-show="commit"><Button type="submit" @click="commit(item.title,item.id)">评价</Button></td>
                <td><Button type="submit" @click="showcommit(item.id)">查看所有评论</Button></td>
                
            </tr>
        </table>

    </div>
</template>

<script>
export default {
    data () {
        return {
           
            //商品容器
             goodlist:[],
             commitlist:[]
          
            
        }
    },
    methods: {
        showcommit(id){
            this.$router.push('showcommit')
            localStorage.setItem('gid',id)
        },
        
        // 商品展示
        goodslist(){
             this.axios.get('http://127.0.0.1:8000/myroad/myroadshow/')
             .then(result=>{
                 console.log(result)
                this.goodlist=result.data.message
  
                // console.log(localStorage.getItem('username'))
             
                
              
             })

        },

        commit(title,id){

            localStorage.setItem('gid',id)
            localStorage.setItem('title',title)
            this.$router.push('studycommit')
        }

    },
    mounted() {
        this.goodslist()
    },

}
</script>

<style>

</style>
